/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BoolDescripteur.java
 *
 * Created on 1 juin 2011, 15:36:19
 */
package cbrtator.Descripteur;

import java.util.ArrayList;
import org.jdesktop.application.Action;
import rapc.descripteur;
import rapc.descripteurBool;

/**
 *
 * @author rikoukiki
 */
public class BoolDescripteur extends javax.swing.JPanel {

    private ArrayList<descripteur> ldescripteur;
    /** Creates new form BoolDescripteur */
    
     public BoolDescripteur() {
       
        initComponents();
    }
    
    public BoolDescripteur(ArrayList<descripteur> ldescripteur) {
        this.ldescripteur=ldescripteur;
        initComponents();
    }
    
    @Action
    public void ajouteDes(){
        
        descripteurBool des = new descripteurBool();
        
        des.setCaseId("exemple");
       
        //nom
        des.setNom(Tnom.getText());
        //val def
        des.setdefVal(Tvaldef.isSelected());
        
        //val norm
        des.setNorm(TvalNorm.isSelected());
        
        //commentaire
        des.setExplication(Tcommentaire.getText());
        ldescripteur.add(des);
          
        
        
    }

    private class AjouteDesTask extends org.jdesktop.application.Task<Object, Void> {
        AjouteDesTask(org.jdesktop.application.Application app) {
            // Runs on the EDT.  Copy GUI state that
            // doInBackground() depends on from parameters
            // to AjouteDesTask fields, here.
            super(app);
        }
        @Override protected Object doInBackground() {
            // Your Task's code here.  This method runs
            // on a background thread, so don't reference
            // the Swing GUI from here.
            return null;  // return your result
        }
        @Override protected void succeeded(Object result) {
            // Runs on the EDT.  Update the GUI based on
            // the result computed by doInBackground().
        }
    }
    
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Normal = new javax.swing.JLabel();
        Vald = new javax.swing.JLabel();
        Tnom = new javax.swing.JTextField();
        nom = new javax.swing.JLabel();
        Commentaire = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        Tcommentaire = new javax.swing.JTextArea();
        Enregistrer = new javax.swing.JButton();
        Tvaldef = new javax.swing.JCheckBox();
        TvalNorm = new javax.swing.JCheckBox();

        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(cbrtator.CbrtatorApp.class).getContext().getResourceMap(BoolDescripteur.class);
        Normal.setText(resourceMap.getString("Normal.text")); // NOI18N
        Normal.setName("Normal"); // NOI18N

        Vald.setText(resourceMap.getString("Vald.text")); // NOI18N
        Vald.setName("Vald"); // NOI18N

        Tnom.setName("Tnom"); // NOI18N
        Tnom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TnomActionPerformed(evt);
            }
        });

        nom.setText(resourceMap.getString("nom.text")); // NOI18N
        nom.setName("nom"); // NOI18N

        Commentaire.setText(resourceMap.getString("Commentaire.text")); // NOI18N
        Commentaire.setName("Commentaire"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        Tcommentaire.setColumns(20);
        Tcommentaire.setRows(5);
        Tcommentaire.setName("Tcommentaire"); // NOI18N
        jScrollPane1.setViewportView(Tcommentaire);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(cbrtator.CbrtatorApp.class).getContext().getActionMap(BoolDescripteur.class, this);
        Enregistrer.setAction(actionMap.get("ajouteDes")); // NOI18N
        Enregistrer.setName("Enregistrer"); // NOI18N

        Tvaldef.setText(resourceMap.getString("Tvaldef.text")); // NOI18N
        Tvaldef.setName("Tvaldef"); // NOI18N

        TvalNorm.setText(resourceMap.getString("TvalNorm.text")); // NOI18N
        TvalNorm.setName("TvalNorm"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(Enregistrer, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(Commentaire)
                            .addGap(31, 31, 31)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE))
                        .addComponent(Normal)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(nom)
                                .addComponent(Vald))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(Tvaldef)
                                .addComponent(TvalNorm)
                                .addComponent(Tnom, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(114, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nom)
                    .addComponent(Tnom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Vald)
                    .addComponent(Tvaldef))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Normal)
                    .addComponent(TvalNorm))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Commentaire))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(Enregistrer)
                .addContainerGap(78, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void TnomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TnomActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TnomActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Commentaire;
    private javax.swing.JButton Enregistrer;
    private javax.swing.JLabel Normal;
    private javax.swing.JTextArea Tcommentaire;
    private javax.swing.JTextField Tnom;
    private javax.swing.JCheckBox TvalNorm;
    private javax.swing.JCheckBox Tvaldef;
    private javax.swing.JLabel Vald;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel nom;
    // End of variables declaration//GEN-END:variables
}
